package com.yesep.business;

import com.alibaba.dubbo.common.utils.NamedThreadFactory;
import com.yesep.handler.MessageHandler;
import com.yesep.model.MessageBaseModel;
import io.netty.channel.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * @program: envm
 * @description: 业务线程
 * @author: quliang
 * @create: 2019-07-30 15:14
 **/
public class BusinessHandlerTask implements Runnable {

    private static Logger logger = LoggerFactory.getLogger(BusinessHandlerTask.class);


    MessageBaseModel data;

    public BusinessHandlerTask(MessageBaseModel data) {
        this.data = data;
    }

    @Override
    public void run() {
        if (Objects.equals(data, null)) return;
        Object message = data.getMessage();
        Channel channel = data.getChannel();
        if (Objects.equals(message, null) || Objects.equals(channel, null)) return;
        //业务处理
        MessageHandler.doBusiness(channel, message);
    }
}
